home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Documents / NeXTAnswers / objc.516 < prev    next >
Text File  |  1992-02-06  |  1KB  |  64 lines

  1. {\rtf0\ansi{\fonttbl\f1\fswiss Helvetica;\f0\fmodern Courier;\f3\fnil Times-Roman;}
  2. \paperw11440
  3. \paperh6000
  4. \margl120
  5. \margr120
  6. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f1\b0\i0\ul0\fs24 compiler strong typing causes circular references\
  7. \
  8. Q:  I like to use strong typing in my applications but this sometimes causes problems.  For example, take 
  9. \b Bagel.h
  10. \b0 \
  11. \
  12.  
  13. \f0     #import <objc/Object.h>\
  14.     #import "Mold.h"\
  15.     \
  16.     @interface Bagel:Object\
  17.     \{\
  18.           Mold *someMold;\
  19.     \}\
  20.     @end\
  21.  
  22. \f1     \
  23. and 
  24. \b Mold.h
  25. \b0 \
  26. \
  27.  
  28. \f0     #import <objc/Object.h>\
  29.     #import "Bagel.h"\
  30.     \
  31.     @interface Mold:Object\
  32.     \{\
  33.           Bagel *aBagel;\
  34.     \}\
  35.     @end\
  36.  
  37. \f1 \
  38. The compiler doesn't like the circular reference my strong typing causes.  What can I do?\
  39. \
  40. \
  41. A:  There's no elegant way to avoid this problem.  Modifying 
  42. \b Mold.h
  43. \b0  to look like the following will remove the problem:\
  44. \
  45.  
  46. \f0     #import <objc/Object.h>\
  47.     #import "Bagel.h"\
  48.     \
  49.     @interface Mold : Object\
  50.     \{\
  51.           
  52. \b struct
  53. \b0  Bagel *aBagel;\
  54.     \}\
  55.     @end\
  56.  
  57. \f1 \
  58. Valid for 1.0\
  59. Valid for 2.0\
  60. \
  61. QA516            \
  62. \
  63.  
  64.